1. Field of the Invention
This invention generally relates to editors and more particularly, a method and apparatus for an extensible editor.
2. Description of the Related Art
Conventional text editors are designed as monolithic software applications containing a variety of functions. Software developers include as many features as possible in these text editor application in hopes of attracting a large number of users. Unfortunately, by adding these features many text editors have become increasingly difficult to use and complex. For example, to find a particular function or feature, a user may have to search through complex menu-driven selections or even learn complex macros to configure the text editor appropriately.
Despite their complexity, many text editors still do not meet the user""s needs and may even provide many unnecessary features. Their monolithic design generally makes it difficult for users to modify the resident functions and features it provides. Even if such modifications were attempted, it would require a significant portion of the code to be rewritten which is prohibitively expensive.
A method consistent with the invention executed on computer processor for the formatting and displaying of text is provided. Initially, the method creates style objects having formatting information for text elements of a document arranged in a hierarchy. The style objects include formatting information for document text elements; paragraph text elements; and character text elements. These style objects can be hierarchically arranged as subclasses. Next, the method provides view objects to display text elements of the document. The view objects are hierarchically arranged as subclasses according to the hierarchy of text elements. Using information associated with the style objects, the text elements in the document are formatted and then displayed using the view objects.
An apparatus consistent with the present invention for formatting and displaying text is also provided. The apparatus includes, the GUI application can also add new styles to elements in the hierarchy of text elements. To accomplish this task, the GUI application subclasses a new style object capable of applying the new style to the element in the hierarchy of elements and then subclasses a new view object capable of displaying the new style to the element in the hierarchy of elements. The new style object is used to format the associated text element and the new view object then displays the information on a display device.